// 粒子效果样式
.particle-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.particle {
  position: absolute;
  font-size: 14px;
  user-select: none;
  pointer-events: none;
  will-change: transform;
  
  // 基础动画
  animation-duration: 0.5s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

// 冬天雪花粒子
.particle-winter {
  font-size: 12px;
  color: #ffffff;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  animation-name: winterParticle;
  animation-duration: 2s;
  
  &:nth-child(3n) {
    animation-duration: 2.5s;
    animation-delay: 0.3s;
  }
  
  &:nth-child(3n+1) {
    animation-duration: 1.8s;
    animation-delay: 0.6s;
  }
}

// 秋天叶子粒子
.particle-autumn {
  font-size: 13px;
  animation-name: autumnParticle;
  animation-duration: 3s;
  
  &:nth-child(4n) {
    animation-duration: 2.8s;
    animation-delay: 0.4s;
  }
  
  &:nth-child(4n+1) {
    animation-duration: 3.2s;
    animation-delay: 0.8s;
  }
  
  &:nth-child(4n+2) {
    animation-duration: 2.5s;
    animation-delay: 1.2s;
  }
}

// 春天花瓣粒子
.particle-spring {
  font-size: 11px;
  animation-name: springParticle;
  animation-duration: 2.5s;
  
  &:nth-child(5n) {
    animation-duration: 2.2s;
    animation-delay: 0.5s;
  }
  
  &:nth-child(5n+1) {
    animation-duration: 2.8s;
    animation-delay: 1s;
  }
  
  &:nth-child(5n+2) {
    animation-duration: 2.3s;
    animation-delay: 1.5s;
  }
}

// 夏天光粒子
.particle-summer {
  font-size: 10px;
  animation-name: summerParticle;
  animation-duration: 1.5s;
  text-shadow: 0 0 8px currentColor;
  
  &:nth-child(6n) {
    animation-duration: 1.8s;
    animation-delay: 0.2s;
  }
  
  &:nth-child(6n+1) {
    animation-duration: 1.3s;
    animation-delay: 0.4s;
  }
  
  &:nth-child(6n+2) {
    animation-duration: 1.6s;
    animation-delay: 0.6s;
  }
  
  &:nth-child(6n+3) {
    animation-duration: 1.4s;
    animation-delay: 0.8s;
  }
}

// 动画关键帧
@keyframes winterParticle {
  0%, 100% { 
    transform: scale(var(--particle-scale, 1)) rotate(0deg);
    opacity: 0.8;
  }
  25% { 
    transform: scale(calc(var(--particle-scale, 1) * 1.1)) rotate(90deg);
    opacity: 1;
  }
  50% { 
    transform: scale(calc(var(--particle-scale, 1) * 0.9)) rotate(180deg);
    opacity: 0.6;
  }
  75% { 
    transform: scale(calc(var(--particle-scale, 1) * 1.05)) rotate(270deg);
    opacity: 0.9;
  }
}

@keyframes autumnParticle {
  0%, 100% { 
    transform: scale(var(--particle-scale, 1)) rotate(0deg);
    opacity: 0.7;
  }
  20% { 
    transform: scale(calc(var(--particle-scale, 1) * 1.1)) rotate(-15deg);
    opacity: 0.9;
  }
  40% { 
    transform: scale(calc(var(--particle-scale, 1) * 0.95)) rotate(10deg);
    opacity: 0.8;
  }
  60% { 
    transform: scale(calc(var(--particle-scale, 1) * 1.05)) rotate(-8deg);
    opacity: 0.85;
  }
  80% { 
    transform: scale(calc(var(--particle-scale, 1) * 0.98)) rotate(12deg);
    opacity: 0.75;
  }
}

@keyframes springParticle {
  0%, 100% { 
    transform: scale(var(--particle-scale, 1)) rotate(0deg);
    opacity: 0.8;
  }
  33% { 
    transform: scale(calc(var(--particle-scale, 1) * 1.15)) rotate(120deg);
    opacity: 1;
  }
  67% { 
    transform: scale(calc(var(--particle-scale, 1) * 0.85)) rotate(240deg);
    opacity: 0.9;
  }
}

@keyframes summerParticle {
  0%, 100% { 
    transform: scale(var(--particle-scale, 1));
    opacity: 0.6;
    filter: brightness(1);
  }
  25% { 
    transform: scale(calc(var(--particle-scale, 1) * 1.3));
    opacity: 1;
    filter: brightness(1.5);
  }
  50% { 
    transform: scale(calc(var(--particle-scale, 1) * 0.7));
    opacity: 0.4;
    filter: brightness(0.8);
  }
  75% { 
    transform: scale(calc(var(--particle-scale, 1) * 1.1));
    opacity: 0.8;
    filter: brightness(1.2);
  }
}

// 性能优化 - 减少重绘
.particle-effect {
  transform: translateZ(0);
  backface-visibility: hidden;
  perspective: 1000px;
}

.particle {
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

// 响应式设计
@media (max-width: 768px) {
  .particle {
    font-size: 10px;
    
    &.particle-winter { font-size: 9px; }
    &.particle-autumn { font-size: 10px; }
    &.particle-spring { font-size: 8px; }
    &.particle-summer { font-size: 7px; }
  }
}

@media (max-width: 480px) {
  .particle-effect {
    display: none; // 小屏幕设备隐藏粒子效果以提升性能
  }
}

// 减少动画在低性能设备上的影响
@media (prefers-reduced-motion: reduce) {
  .particle {
    animation: none;
    opacity: 0.3;
  }
}
